﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ABCLogistic_System_V2._0.GUI;
using ABCLogistic_System_V2._0.BL;

namespace ABCLogistic_System_V2._0
{
    public partial class frmLogin : Form
    {
        public frmLogin()
        {
            InitializeComponent();
        }

        #region Xu ly cac truong hop thoat chuong trinh
        /// <summary>
        /// xet du lieu trong cac textbox la rong de dong cua so dang nhap
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnExit_Click(object sender, EventArgs e)
        {
            if (txtusername.Text == "" || txtpassword.Text == "")
            {
                this.Close();
            }
        }

        /// <summary>
        /// xet du lieu trong cac textbox co du lieu thi thong bao va dong hoac dang nhap
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmLogin_FormClosing(object sender, FormClosingEventArgs e)
        {
             if (txtusername.Text != "" || txtpassword.Text != "")
            {
                DialogResult result = MessageBox.Show("Bạn muốn thoát?", "Thông báo!", MessageBoxButtons.YesNo,MessageBoxIcon.Warning);
                if (result == DialogResult.No)
                {
                    e.Cancel = true;
                }
            }
        }
        #endregion

        #region Xu ly dang nhap

        /// <summary>
        /// xu ly nut dang nhap
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            frmMainInterface giaodienchinh = new frmMainInterface();
            this.Hide();
            giaodienchinh.Show();
        }

        #endregion
    }
}
